Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


ON statement

Class files can define static visual objects. The standard Progress visual objects expose a well-defined set of events that an application can respond to, by using the ON statement. The ON statement is supported in the main block of a class file. As noted previously, the main block cannot contain executable code. Therefore a class file cannot specify an ON statement within executable conditional logic, nor can it contain a WAIT-FOR statement in the main block. However, the main block can contain ON statements that respond to a specific event that occurs on a static visual object.

The following code demonstrates this capability:

CLASS Disp: 
    DEFINE BUTTON msg.    /* These data members are PRIVATE by default. */ 
    DEFINE BUTTON done. 
    DEFINE FRAME f msg done. 
    ON 'choose':U OF msg  /* Unconditional ON block valid in the main block. */ 
        MESSAGE "click" VIEW-AS ALERT-BOX. 
    CONSTRUCTOR PUBLIC Disp ( ): 
        modal_display ( ). 
    END CONSTRUCTOR. 
    METHOD PRIVATE VOID modal_display ( ): /* WAIT-FOR is done in a method. */ 
        ENABLE ALL WITH FRAME f. 
        WAIT-FOR CHOOSE OF done. 
    END METHOD. 
END CLASS. 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095